#!/bin/bash
# parameter 1: sql file
# parameter 2: host
# parameter 3: port
# parameter 4: password

set -eu

TIDB_PORT=4000
user="root"
if [[ "$3" = $TIDB_PORT ]]; then
	user="test"
fi

echo "[$(date)] Executing SQL: $1" >"$TEST_DIR/sql_res.$TEST_NAME.txt"
mysql -u$user -h$2 -P$3 -p$4 --default-character-set utf8 -vv <"$1" >>"$TEST_DIR/sql_res.$TEST_NAME.txt"
